//
//  OAabookViewController.m
//  LongOA
//
//  Created by 耿用强 on 15/7/5.
//  Copyright (c) 2015年 耿用强. All rights reserved.
//

#import "OASettingViewController.h"
#import "OAPersonCenterViewController.h"
#import "AppDelegate.h"
#import "OAacountSetViewController.h"

@interface OASettingViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    NSArray*_nameArray;
}
@end

@implementation OASettingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _nameArray=@[@"账套设置",@"用户个性设置",@"已缓存:",@"当前版本:1.0.05"];
    [self setNavBarleftBtn:@"" andlDimg:@"" rightBtn:@"" andrImg:@"" title:@"龙嘉OA" ];
    
    [self buildTables:CGRectMake(0, HEADER_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT-HEADER_HEIGHT) andHeaderView:nil andFooterView:nil andAlwaysBounceVertical:YES Delegate:self DataSouce:self];
    self.tableView.separatorStyle=UITableViewCellSeparatorStyleSingleLine;
    
    // Do any additional setup after loading the view.
}


#pragma mark - UITableViewDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _nameArray.count;
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString*homeCellIdentifer=@"homeCellIdentifer";
    UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:homeCellIdentifer];
    if (cell==nil) {
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:homeCellIdentifer];
    }
    cell.textLabel.text=_nameArray[indexPath.row];
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row==1) {
        OAPersonCenterViewController*personVc=[[OAPersonCenterViewController alloc]init];
        [self.navigationController pushViewController:personVc animated:YES];
    }
    else if (indexPath.row == 0){
        AppDelegate*app=APPDELEGATE;
        OAacountSetViewController*acountVc=[[OAacountSetViewController alloc]init];
        
        //OAEmailViewController* acountVc=[[OAEmailViewController alloc] init];
        UINavigationController*nav=[[UINavigationController alloc]initWithRootViewController:acountVc];
        nav.navigationBarHidden=YES;
        app.window.rootViewController = nav;
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
